<template>
    <div class="wrapper">
        <header>
            <p>我的订单</p>
        </header>

        <h3>未支付订单信息：</h3>
        <ul class="order">
            <li v-for="item in orderArr" v-bind:key="item.orderId">
                <div v-if="item.orderState ==0">
                    <div class="order-info">
                        <p>
                            {{ item.business.businessName }}
                            <i class="fa fa-caret-down" @click="detailetShow(item)"></i>

                        </p>
                        <div class="order-info-right">
                            <p>&#165;{{ item.orderToal }}</p>
                            <div class="order-info-right-icom">去支付</div>
                        </div>
                    </div>
                    <ul class="order-detailet" v-show="item.isShowDetailet">
                        <li v-for="odItem in item.odList" v-bind:key="odItem.orderId">
                            <p>{{ odItem.food.foodName }}X{{ odItem.quantity }}</p>
                            <p>&#165;{{ odItem.food.foodPrice*odItem.quantity }}</p>
                        </li>
                        <li>
                            <p>配送费</p>
                            <p>&#165;{{ item.business.deliveryPrice }}</p>
                        </li>
                    </ul>
                </div>
            </li>
        </ul>
    </div>
    <Footer></Footer>
</template>
<script>
export default{
    name:'OrderList',
    data(){
        return{
            orderArr:[],
            user:{}
        }
    },
    created(){
        this.user = this.$getSessionStorage("user");
        this.$axios.post('',this.$qs.stringify({
            userId:this.user.userId
        })).then(response =>{
            let result = response.data;
            for(let orders of result){
                orders.isShowDetailet =false;
            }
            this.orderArr =result;
            console.log(this.orderArr);
            
        }).catch(error =>{
            console.error(error);
            
        })
    },
    methods:{
        detailetShow(orders){
            orders.isShowDetailet = !orders.isShowDetailet;
        }
    }
    
}

</script>